package com.usian.admin.controller.v1;

import com.usian.admin.service.UserLoginService;

import com.usian.apis.admin.v1.AdLoginControllerApi;
import com.usian.model.admin.dtos.AdUserDto;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/login")
public class AdLoginController implements AdLoginControllerApi {

    @Autowired
    private UserLoginService userLoginService;

    @RequestMapping("/in")
    @Override
    public ResponseResult login(@RequestBody AdUserDto dto) {
        return userLoginService.login(dto);
    }

    @Override
    @RequestMapping("/mes/{id}")
    public ResponseResult mes(@PathVariable Integer id) {
        return userLoginService.find(id);
    }
}
